package com.zw.pdm.module.craft.controller;

import com.zw.pdm.base.BaseController;
import com.zw.pdm.common.JsonResult;
import com.zw.pdm.entity.est.Card;
import com.zw.pdm.entity.rep.Result;
import com.zw.pdm.module.basic.service.DictCommonService;
import com.zw.pdm.module.craft.model.ComprehensiveQueryModel;
import com.zw.pdm.module.craft.model.CraProQueryModel;
import com.zw.pdm.module.craft.service.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.zw.pdm.constant.Constant.GROUP_SPECTYPE;

/**
 * @Description: 计划查询接口
 * @Author: China.sgl
 * @Date: 2020/8/3 16:11
 */
@Controller
@RequestMapping("/craft/ComprehensiveQuery")
@SuppressWarnings("all")
public class ComprehensiveQueryController extends BaseController {

    @Autowired
    private CraftReceiveService craftReceiveService;
    @Autowired
    private DictCommonService dictCommonService;
    @Autowired
    private CraftReleaseService craftReleaseService;
    @Autowired
    private CraftMaintainService craftMaintainService;
    @Autowired
    private ComprehensiveQueryService comprehensiveQueryService;

    @GetMapping
    @RequiresPermissions({"tec:protaskQuery:view"})
    public String page(Model model) {
//        model.addAttribute("specialId", dictCommonService.findDictByGroupName(GROUP_SPECTYPE));
//        model.addAttribute("deptName", craftReleaseService.findCraftSectionByDeptId(4));
//        return "craft/comprehensive/query";
        model.addAttribute("taskTypes", comprehensiveQueryService.findDsnComTaskName());
        return "craft/proQuery/gantPage";
    }

    /**
     * 接收列表
     */
    @ResponseBody
    @PostMapping("/query")
//    @RequiresPermissions({"report:query:view"})
    public JsonResult list(ComprehensiveQueryModel comprehensiveQueryModel) {
        startPage();
        List<ComprehensiveQueryModel> list = comprehensiveQueryService.selectPro(comprehensiveQueryModel);
        return jsonResult(list);
    }
}
